<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户信息表列表</title>
</head>
<body>
<form>
       输入关键字：<input id="keyword" name="keyword"/>
    <input type="button" value="查询" id="cxBtn"/>
</form>
<table width="100%" border="1">
    <caption>用户信息表列表</caption>
    <thead>
    <tr style="font-weight:bold;background:#a0a0ff">
            <td>自增主键ID</td>
            <td>customer_login表的自增ID</td>
            <td>用户真实姓名</td>
            <td>证件号码</td>
            <td>手机号</td>
            <td>邮箱</td>
            <td>用户积分</td>
            <td>注册时间</td>
            <td>会员生日</td>
            <td>会员级别：1 普通会员，2 青铜，3白银，4黄金，5钻石</td>
            <td>用户余额</td>
            <td>最后修改时间</td>
            <td>其他</td>
            <td>其他</td>
        <td>操作</td>
    </tr>
    </thead>
    <tbody>
    </tbody>
</table>
<script src="/js/jquery-1.12.4.js"></script>
    <script>
    $(function(){
        fill("/customerinf/findAll.json","");
        $("#cxBtn").click(function(){
            fill("/customerinf/query.json",$("form").serialize());
        });
    });
    //填充数据
    function fill(url,data){
        $.getJSON(url,data,function(list){
            $("tbody").empty();
            for(var i in list){
                var detail = list[i];
                var str="<tr>";
                str+="<td>"+detail.customerInfId+"</td><td>"+detail.customerId+"</td><td>"+detail.customerName+"</td><td>"+detail.identityCardNo+"</td><td>"+detail.mobilePhone+"</td><td>"+detail.customerEmail+"</td><td>"+detail.userPoint+"</td><td>"+detail.registerTime+"</td><td>"+detail.birthday+"</td><td>"+detail.customerLevel+"</td><td>"+detail.userMoney+"</td><td>"+detail.modifiedTime+"</td><td>"+detail.other1+"</td><td>"+detail.other2+"</td>";
                str+="<td><a href='javascript:view("+detail.customerInfId+")'>查看</a>&nbsp;&nbsp;";
                str+="<a href='javascript:update("+detail.customerInfId+")'>修改</a>&nbsp;&nbsp;";
                str+="<a href='javascript:del("+detail.customerInfId+")'>删除</a>";
                str+="</td></tr>";
                $("tbody").append(str);
            }
        });
    }
    //查看明细
    function view(customerInfId){
        location.href="/admin/customerinf/detail.html?customerInfId="+customerInfId;
    }
    //更新
    function update(customerInfId){
        location.href="/admin/customerinf/update.html?customerInfId="+customerInfId;
    }
    //删除
    function del(id){
        $.post("/customerinf/delete.json",
               {customerInfId:customerInfId},
               function(result){
                   if(result.flag==true){
                        fill("/customerinf/query.json",$("form").serialize());
                        alert("删除成功");
                   }else{
                        alert("删除失败");
                   }
               },"json");
    }
</script>
</body>
</html>